<?php
/**
 * Each engineer has a duty to keep the code elegant
 * Created by wolffy.
 * Author @wolffy<13750088090@sina.cn>
 * Date: 2018/8/12
 * Time: 11:40
 */
namespace App\Repositories;

use App\Models\BankSupport;

class BankSupportRepository
{
    /**
     * @param array $params
     * @return mixed
     */
    public function create(array $params)
    {
        return BankSupport::create($params);
    }

    public function byPassageIdAndBankCode($passageId, $bankCode)
    {
        return BankSupport::where([
            'passage_id' => $passageId,
            'bank_code' => $bankCode,
            ])->first();
    }

    public function getPassagetToBank($passageId)
    {
        return BankSupport::where([
            'passage_id' => $passageId,
            'is_support' => 1,
        ])->get();
    }
}